<template>
    <p :class="clicked? 'active' : 'no'" @click="changeColor">点击后颜色变化</p>
</template>

<script setup lang='ts'>
    import {ref} from 'vue';

    let clicked = ref(false);

    const changeColor = () => {
        clicked.value = true;
    };

</script>

<style scoped>
    .active{
        color: red;
    }

    .no{
        color: green;
    }
</style>